package spring.aspectj.as;

import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.util.StopWatch;

public class SimpleProfiler {
	public Object profile(ProceedingJoinPoint call,String name,int age)throws Throwable{
		StopWatch clockWatch=new StopWatch("Profiling for '"+name+"' and '"+age+"'");
		try{
			clockWatch.start(call.toShortString());
			return call.proceed();
		}finally{
			clockWatch.stop();
			System.out.println(clockWatch.prettyPrint());
		}
	}
}
